package cn.jasonone.tio.tcp.handler;

import org.tio.core.ChannelContext;

/**
 * 心跳处理器
 *
 * @author xujie
 * @version 1.0
 * @date 2022/1/18 10:14
 */
public interface HeartbeatHandler<H> {
    /**
     * 创建心跳包
     *
     * @param channelContext
     * @return
     */
    H createHeartbeat(ChannelContext channelContext) throws Exception;

    /**
     * 接收心跳包
     *
     * @param heartbeat
     */
    void onHeartbeat(H heartbeat, ChannelContext ctx) throws Exception;
}
